# Maintainer: Johannes Löthberg <johannes@kyriasis.com>
# Maintainer: George Rawlinson <grawlinson@archlinux.org>
# Contributor: Timothy Redaelli <timothy.redaelli@gmail.com>
# Contributor: Vianney le Clément <vleclement AT gmail·com>
# Contributor: Peter Simons <simons@cryp.to>

pkgbase=parallel
pkgname=('parallel' 'parallel-docs')
pkgver=20231122
pkgrel=1
pkgdesc='A shell tool for executing jobs in parallel'
arch=('any')
url='https://www.gnu.org/software/parallel/'
license=('GPL3')
source=(
  "https://ftp.gnu.org/gnu/$pkgbase/$pkgbase-$pkgver.tar.bz2"{,.sig}
  '0001-Remove-citation-things.patch'
)
sha512sums=('4111c1f4b9257d7a954791b9c22c9edee576bedcc03cac9fc5d52ed50370abbe52b16518fa1d8b8af6741dd4426aec5f09f4b2ed96518f5ffbe75c56147752df'
            'SKIP'
            '0c97d0e77abeb93884016516217ffa5defc1a504ee4e05b590388dc1c572f860f564666bbf6395c8f6bb45b14591a515a4056ba38a773a6e82a803fa8d5ff1e1')
b2sums=('5ddd4428c795ff51d2b1866438d72d626fd96deb3d73bc78b4e98d986c003274d4a0ce878cb1943b4d6bbf33531c332e39668b03e3cc458660adbaac2c8f4ef4'
        'SKIP'
        '0a618cc3147cfd9cb0e83edb5b2d08b07f6ed907b9499eac769f1f9fdd2484deab48858fd73a237ee56caa0b787b4f7ce39c460a64daf099dc193e41f35b8ce7')
validpgpkeys=('CDA01A4208C4F74506107E7BD1AB451688888888')

prepare() {
  cd "$pkgbase-$pkgver"

  # remove citation warnings
  # https://en.opensuse.org/openSUSE:Packaging_guidelines#Donation_requests
  patch -p1 -i "$srcdir/0001-Remove-citation-things.patch"
}

build() {
  cd "$pkgbase-$pkgver"

  ./configure --prefix=/usr

  make
}

package_parallel() {
  depends=('perl' 'procps')
  optdepends=('parallel-docs: documentation')

  cd "$pkgbase-$pkgver"

  make DESTDIR="$pkgdir" install

  # split documentation out of main package
  mv "$pkgdir/usr/share/doc" docs
}

package_parallel-docs() {
  pkgdesc+=' (documentation)'

  cd "$pkgbase-$pkgver"

  install -vd "$pkgdir/usr/share/doc"
  mv -v docs/* "$pkgdir/usr/share/doc"
}

# vim:set ts=2 sw=2 et:
